var verify_cd_status_retailTax_baseMsg = JSON.parse('{"CODE":0, "ACTION":"","LEVEL":"T1", "MSG":"","DATA":"","SCRIPTNAME":"verify_cd_status_retailTax"}');
if (!isNull(retail_tax)) {
    // 标识： 是否为CD状态且价格上涨了
    var isCdUp = false;
    if (!isNull(item_store_json)) {
        //商品门店数据
        var list = JSON.parse(item_store_json);
        if (!isNull(list)) {
            // 如果提报详情是到门店的
            if (!isNull(store_id)) {
                // 如果是门店。
                if (store_type == 1) {
                    for (var i = 0; i < list.length; i++) {
                        var obj = list[i];
                        var retailTax = func_active_price_tax(obj.price_action_comp_retail, obj.price_action_pc_retail, iva_tax);

                        if (obj.store_id == store_id && !isNull(retailTax)) {
                            if (retail_tax > retailTax && (obj.item_store_status == "C" || obj.item_store_status == "D")) {
                                isCdUp = true;
                                break;
                            }
                        }
                    }
                }
            }

            // 如果是全国的
            else if (trait_nbr == "ALL") {
                for (var i = 0; i < list.length; i++) {
                    var obj = list[i];
                    var retailTax = func_active_price_tax(obj.price_action_comp_retail, obj.price_action_pc_retail, iva_tax);
                    if (!isNull(retailTax) && retail_tax > retailTax && (obj.item_store_status == "C" || obj.item_store_status == "D")) {
                        isCdUp = true;
                        break;
                    }
                }
            }

            // 如果是到城市的
            else if (!isNull(trait_nbr)) {
                if (!isNull(trait_store)) {
                    // 获取城市对应的所有门店
                    var stores = trait_store.get(trait_nbr);
                    if (!isNull(stores)) {
                        for (var i = 0; i < list.length; i++) {
                            var obj = list[i];

                            for (var k = 0; k < stores.length; k++) {
                                var store = stores[k];
                                if (store_type == 1 && obj.store_id == store) {
                                    var retailTax = func_active_price_tax(obj.price_action_comp_retail, obj.price_action_pc_retail, iva_tax);

                                    if (retail_tax > retailTax && (obj.item_store_status == "C" || obj.item_store_status == "D")) {
                                        isCdUp = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (isCdUp) {
                verify_cd_status_retailTax_baseMsg.CODE = 2;
                verify_cd_status_retailTax_baseMsg.ACTION = 'error';
                verify_cd_status_retailTax_baseMsg.MSG = 'C,D状态售价不可上涨';
            }
        }

    }
}
JSON.stringify(verify_cd_status_retailTax_baseMsg);
